import pandas as pd

# 读取CSV文件
df = pd.read_csv('_test.csv')

# 将grade列的值映射为A-G
grade_mapping = {1: 'A', 2: 'B', 3: 'C', 4: 'D', 5: 'E', 6: 'F', 7: 'G'}
df['grade'] = df['grade'].map(grade_mapping)
home_ownership_mapping={1:'MORTGAGE',2:'RENT',3:'OWN'}
df['home_ownership'] = df['home_ownership'].map(home_ownership_mapping)
# 保存修改后的数据为新的CSV文件
df.to_csv('test.csv', index=False)
